/**
 *
*/
package GUI_SPR;

//Se importa lo necesario
import java.awt.BorderLayout;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import persistence.UsoPersisteceMySQLConnection;
import sourceCode.Cuenta;

/**
 * @version 1.0
 * @author edwin
 */

public class MenuIngreso extends javax.swing.JFrame {

    
    //-----------------------------------------------------------------
    //  Constructor:.
    //-----------------------------------------------------------------

    /**
     * Método que permite la creación de un nuevo objeto de MenuCategorias.
     */
    public MenuIngreso() {
        initComponents();
        ocultarPanels();
        //Se coloca el fondo de la ventana.
        Fondo fondo = new Fondo (800,600,"fondo1.jpg");
        this.add(fondo,BorderLayout.CENTER);
        try {
            this.nombreUsuarioShowL.setText(cuenta.getUsuario());
        }
        catch(Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
        this.pack();

        //Coloca las categorias en el combo box.
       }
    
    //------------------------------------------------------------------------
    //Métodos 
    //------------------------------------------------------------------------
    
    public static void setCuenta(String usuarioX, String contrasenaC){
        cuenta.setUsuario(usuarioX);
        cuenta.setContraseñaMaestra(contrasenaC);
    }
    public static void setCuenta(Cuenta cuentaX){
        cuenta = cuentaX;
    }
    
    public void ocultarPanels(){
        ProveedorJP.setVisible(false);
        MarcaJP.setVisible(false);
        ProductoJP.setVisible(false);
    }
    
    /**
     * Método que permite decidir que titulo poseerá la ventana
     * @param titulo El nombre de la imagen con el título
     */
    public void setTitulo(String titulo){
        ImageIcon imagen = new ImageIcon (new ImageIcon (getClass().getResource("/imagenes/icon/"+titulo)).getImage());
        this.tituloPanelL.setIcon(imagen);  
    }
    
    /**
     * Método que permite seleccionar si se desea hacer busqueda o ingreso.
     * @param seleccion 
     */
    public void setSeleccion (boolean seleccion){
        this.seleccion=seleccion;
        if (seleccion==false){
            this.cancelarB.setVisible(false);
            this.resize(446,350);
        }
    }

    
    /**
     * Método que limpia los campos.
     */
    private void limpiar (){
        this.usuarioTF.setText("");
        this.contraseñaTF.setText("");
    }
  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        categoriaCBox = new javax.swing.JComboBox();
        backmenuB = new javax.swing.JButton();
        cancelarB = new javax.swing.JButton();
        aceptarB = new javax.swing.JButton();
        usuarioShowL = new javax.swing.JLabel();
        nombreUsuarioShowL = new javax.swing.JLabel();
        tituloPanelL = new javax.swing.JLabel();
        MarcaJP = new javax.swing.JPanel();
        usuarioTF1 = new javax.swing.JTextField();
        detalleXM = new javax.swing.JLabel();
        nombreLp = new javax.swing.JLabel();
        IDp1 = new javax.swing.JLabel();
        ID_p1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        ProductoJP = new javax.swing.JPanel();
        usuarioTF = new javax.swing.JTextField();
        contraseñaTF = new javax.swing.JTextField();
        precioDventa = new javax.swing.JLabel();
        precioSventa = new javax.swing.JLabel();
        precioDcompra = new javax.swing.JLabel();
        proveedor = new javax.swing.JLabel();
        marcaL = new javax.swing.JLabel();
        nombreL = new javax.swing.JLabel();
        codigoL = new javax.swing.JLabel();
        IDp = new javax.swing.JLabel();
        ID_p = new javax.swing.JLabel();
        marcaTB = new javax.swing.JComboBox();
        proveedorCB = new javax.swing.JComboBox();
        precioCompra = new javax.swing.JFormattedTextField();
        precioSVenta = new javax.swing.JFormattedTextField();
        precioVenta = new javax.swing.JFormattedTextField();
        precioCompra1 = new javax.swing.JFormattedTextField();
        precioDcompra1 = new javax.swing.JLabel();
        precioCompra2 = new javax.swing.JFormattedTextField();
        precioDcompra2 = new javax.swing.JLabel();
        ProveedorJP = new javax.swing.JPanel();
        usuarioTF2 = new javax.swing.JTextField();
        detalleXM1 = new javax.swing.JLabel();
        nombreLp1 = new javax.swing.JLabel();
        IDp2 = new javax.swing.JLabel();
        ID_p2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Busqueda");

        categoriaCBox.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        categoriaCBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "Producto de Tienda", "Producto de Libreria", "Productos varios", "Proveedores", "Marcas" }));
        categoriaCBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                categoriaCBoxItemStateChanged(evt);
            }
        });
        categoriaCBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoriaCBoxActionPerformed(evt);
            }
        });

        backmenuB.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        backmenuB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon/home.png"))); // NOI18N
        backmenuB.setText("Menu");
        backmenuB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backmenuBActionPerformed(evt);
            }
        });

        cancelarB.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        cancelarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon/cancel.png"))); // NOI18N
        cancelarB.setText("Cancelar");
        cancelarB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelarBActionPerformed(evt);
            }
        });

        aceptarB.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        aceptarB.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon/go.png"))); // NOI18N
        aceptarB.setText("Aceptar");
        aceptarB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aceptarBActionPerformed(evt);
            }
        });

        usuarioShowL.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        usuarioShowL.setText("Usuario: ");

        nombreUsuarioShowL.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        nombreUsuarioShowL.setText("-----------");

        tituloPanelL.setFont(new java.awt.Font("Bookman Old Style", 0, 18));
        tituloPanelL.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/icon/search1.png"))); // NOI18N

        usuarioTF1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        usuarioTF1.setText("  ");
        usuarioTF1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usuarioTF1ActionPerformed(evt);
            }
        });

        detalleXM.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        detalleXM.setText("Detalle");

        nombreLp.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        nombreLp.setText("Nombre");

        IDp1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        IDp1.setText("ID");

        ID_p1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        ID_p1.setText("xxxx");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        javax.swing.GroupLayout MarcaJPLayout = new javax.swing.GroupLayout(MarcaJP);
        MarcaJP.setLayout(MarcaJPLayout);
        MarcaJPLayout.setHorizontalGroup(
            MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MarcaJPLayout.createSequentialGroup()
                .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MarcaJPLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(ID_p1))
                    .addGroup(MarcaJPLayout.createSequentialGroup()
                        .addGap(79, 79, 79)
                        .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(detalleXM)
                            .addComponent(nombreLp, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(usuarioTF1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(125, Short.MAX_VALUE))
            .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(MarcaJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp1)
                    .addContainerGap(419, Short.MAX_VALUE)))
        );
        MarcaJPLayout.setVerticalGroup(
            MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MarcaJPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ID_p1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usuarioTF1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nombreLp, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MarcaJPLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(detalleXM))
                    .addGroup(MarcaJPLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(80, 80, 80))
            .addGroup(MarcaJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(MarcaJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp1)
                    .addContainerGap(246, Short.MAX_VALUE)))
        );

        usuarioTF.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        usuarioTF.setText("  ");
        usuarioTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usuarioTFActionPerformed(evt);
            }
        });

        contraseñaTF.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        contraseñaTF.setText("  ");
        contraseñaTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                contraseñaTFActionPerformed(evt);
            }
        });

        precioDventa.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        precioDventa.setText("Precio de Venta");

        precioSventa.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        precioSventa.setText("Precio sug. de venta");

        precioDcompra.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        precioDcompra.setText("Precio de unidad");

        proveedor.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        proveedor.setText("Proveedor");

        marcaL.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        marcaL.setText("Marca");

        nombreL.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        nombreL.setText("Nombre");

        codigoL.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        codigoL.setText("Código");

        IDp.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        IDp.setText("ID");

        ID_p.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        ID_p.setText("xxxx");

        marcaTB.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        marcaTB.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                marcaTBItemStateChanged(evt);
            }
        });
        marcaTB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                marcaTBActionPerformed(evt);
            }
        });

        proveedorCB.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        proveedorCB.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                proveedorCBItemStateChanged(evt);
            }
        });
        proveedorCB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                proveedorCBActionPerformed(evt);
            }
        });

        precioCompra.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00"))));
        precioCompra.setText("0.00");
        precioCompra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                precioCompraActionPerformed(evt);
            }
        });
        precioCompra.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                precioCompraFocusLost(evt);
            }
        });
        precioCompra.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                precioCompraInputMethodTextChanged(evt);
            }
        });
        precioCompra.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                precioCompraKeyPressed(evt);
            }
        });

        precioSVenta.setEditable(false);
        precioSVenta.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00"))));
        precioSVenta.setText("0.00");
        precioSVenta.setEnabled(false);
        precioSVenta.setFocusable(false);

        precioVenta.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00"))));
        precioVenta.setText("0.00");

        precioCompra1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00"))));
        precioCompra1.setText("0.00");
        precioCompra1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                precioCompra1ActionPerformed(evt);
            }
        });
        precioCompra1.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                precioCompra1FocusLost(evt);
            }
        });
        precioCompra1.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                precioCompra1InputMethodTextChanged(evt);
            }
        });
        precioCompra1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                precioCompra1KeyPressed(evt);
            }
        });

        precioDcompra1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        precioDcompra1.setText("Precio de paquete");

        precioCompra2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0.00"))));
        precioCompra2.setText("0.00");
        precioCompra2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                precioCompra2ActionPerformed(evt);
            }
        });
        precioCompra2.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                precioCompra2FocusLost(evt);
            }
        });
        precioCompra2.addInputMethodListener(new java.awt.event.InputMethodListener() {
            public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
            }
            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                precioCompra2InputMethodTextChanged(evt);
            }
        });
        precioCompra2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                precioCompra2KeyPressed(evt);
            }
        });

        precioDcompra2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        precioDcompra2.setText("Cant. por paquete");

        javax.swing.GroupLayout ProductoJPLayout = new javax.swing.GroupLayout(ProductoJP);
        ProductoJP.setLayout(ProductoJPLayout);
        ProductoJPLayout.setHorizontalGroup(
            ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ProductoJPLayout.createSequentialGroup()
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ProductoJPLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(ID_p))
                    .addGroup(ProductoJPLayout.createSequentialGroup()
                        .addGap(67, 67, 67)
                        .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(proveedor)
                            .addComponent(marcaL, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(nombreL)
                            .addComponent(codigoL, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(usuarioTF, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(contraseñaTF, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(marcaTB, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(ProductoJPLayout.createSequentialGroup()
                                    .addComponent(precioDcompra2)
                                    .addGap(9, 9, 9)
                                    .addComponent(precioCompra2, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(proveedorCB, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(ProductoJPLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ProductoJPLayout.createSequentialGroup()
                                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(precioSventa)
                                    .addComponent(precioDventa))
                                .addGap(18, 18, 18)
                                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(precioVenta, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(precioSVenta, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(ProductoJPLayout.createSequentialGroup()
                                .addGap(14, 14, 14)
                                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(ProductoJPLayout.createSequentialGroup()
                                        .addComponent(precioDcompra1)
                                        .addGap(18, 18, 18)
                                        .addComponent(precioCompra1, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(ProductoJPLayout.createSequentialGroup()
                                        .addComponent(precioDcompra)
                                        .addGap(18, 18, 18)
                                        .addComponent(precioCompra, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
                .addContainerGap(30, Short.MAX_VALUE))
            .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(ProductoJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp)
                    .addContainerGap(423, Short.MAX_VALUE)))
        );
        ProductoJPLayout.setVerticalGroup(
            ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ProductoJPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ID_p)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usuarioTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(codigoL, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(contraseñaTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nombreL))
                .addGap(7, 7, 7)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(marcaTB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(marcaL))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(proveedorCB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(proveedor))
                .addGap(15, 15, 15)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(precioDcompra1)
                    .addComponent(precioCompra1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(precioCompra2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(precioDcompra2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(precioDcompra)
                    .addComponent(precioCompra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(precioSventa)
                    .addComponent(precioSVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(precioDventa)
                    .addComponent(precioVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(49, 49, 49))
            .addGroup(ProductoJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(ProductoJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp)
                    .addContainerGap(279, Short.MAX_VALUE)))
        );

        usuarioTF2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        usuarioTF2.setText("  ");
        usuarioTF2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                usuarioTF2ActionPerformed(evt);
            }
        });

        detalleXM1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        detalleXM1.setText("Detalle");

        nombreLp1.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        nombreLp1.setText("Nombre");

        IDp2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        IDp2.setText("ID");

        ID_p2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
        ID_p2.setText("xxxx");

        jTextArea2.setColumns(20);
        jTextArea2.setRows(5);
        jScrollPane2.setViewportView(jTextArea2);

        javax.swing.GroupLayout ProveedorJPLayout = new javax.swing.GroupLayout(ProveedorJP);
        ProveedorJP.setLayout(ProveedorJPLayout);
        ProveedorJPLayout.setHorizontalGroup(
            ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ProveedorJPLayout.createSequentialGroup()
                .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ProveedorJPLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addComponent(ID_p2))
                    .addGroup(ProveedorJPLayout.createSequentialGroup()
                        .addGap(79, 79, 79)
                        .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(detalleXM1)
                            .addComponent(nombreLp1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(usuarioTF2, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(125, Short.MAX_VALUE))
            .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(ProveedorJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp2)
                    .addContainerGap(419, Short.MAX_VALUE)))
        );
        ProveedorJPLayout.setVerticalGroup(
            ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ProveedorJPLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ID_p2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usuarioTF2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nombreLp1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ProveedorJPLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(detalleXM1))
                    .addGroup(ProveedorJPLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(80, 80, 80))
            .addGroup(ProveedorJPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(ProveedorJPLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(IDp2)
                    .addContainerGap(246, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(tituloPanelL)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(84, 84, 84)
                                .addComponent(usuarioShowL)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nombreUsuarioShowL))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(categoriaCBox, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(19, 19, 19))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(cancelarB, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(aceptarB, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(backmenuB)
                        .addContainerGap())))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 24, Short.MAX_VALUE)
                    .addComponent(MarcaJP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 25, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 22, Short.MAX_VALUE)
                    .addComponent(ProductoJP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 23, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 24, Short.MAX_VALUE)
                    .addComponent(ProveedorJP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 25, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(tituloPanelL)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(usuarioShowL)
                            .addComponent(nombreUsuarioShowL))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
                        .addComponent(categoriaCBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 345, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(backmenuB)
                    .addComponent(aceptarB))
                .addGap(8, 8, 8)
                .addComponent(cancelarB)
                .addGap(24, 24, 24))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 140, Short.MAX_VALUE)
                    .addComponent(MarcaJP, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 140, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 123, Short.MAX_VALUE)
                    .addComponent(ProductoJP, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 124, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 140, Short.MAX_VALUE)
                    .addComponent(ProveedorJP, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 140, Short.MAX_VALUE)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void contraseñaTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_contraseñaTFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_contraseñaTFActionPerformed

    private void usuarioTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usuarioTFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_usuarioTFActionPerformed

    /**
     * Método que permite regresar al menú principal.
     * @param evt El evento que se da al presionar el botón.
     */
    private void backmenuBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backmenuBActionPerformed
        vaciarTextFields();
        MenuOpciones menu = new MenuOpciones ();
        menu.show();
        dispose();
    }//GEN-LAST:event_backmenuBActionPerformed

    /**
     * Método que permite agregar un campo nuevo a la categoria que se desee.
     * @param evt El evento que se da al presionar el botón.
     */
    private void categoriaCBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoriaCBoxActionPerformed
           
    }//GEN-LAST:event_categoriaCBoxActionPerformed

    /**
     * Método que muestra los campos según la selección que ha haya hecho.
     * @param evt El evento que se da al presionar el bóton.
     */
    private void categoriaCBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_categoriaCBoxItemStateChanged
        setModels(UsoPersisteceMySQLConnection.encontrarNombresMarcas(),UsoPersisteceMySQLConnection.encontrarNombresProveedor() );
        
        ocultarPanels();
        //Determina si está seleccionado en el combo box la opción de aplicación de internet y realiza lo necesario.
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Producto de Tienda")){
                ProductoJP.setVisible(true);
                ID_p.setText("" + (1 + Integer.parseInt(UsoPersisteceMySQLConnection.getCantidadDatos("productos_tienda"))));
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Producto de Libreria")){
                ProductoJP.setVisible(true);
                ID_p.setText("" + (1 + Integer.parseInt(UsoPersisteceMySQLConnection.getCantidadDatos("productos_libreria"))));
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Productos varios")){
                ProductoJP.setVisible(true);
                ID_p.setText("" + (1 + Integer.parseInt(UsoPersisteceMySQLConnection.getCantidadDatos("productos_varios"))));
            }
            else{
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Proveedores")){
                ProveedorJP.setVisible(true);
                ID_p2.setText("" + (1 + Integer.parseInt(UsoPersisteceMySQLConnection.getCantidadDatos("proveedores"))));
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Marcas")){
                MarcaJP.setVisible(true);
                ID_p1.setText("" + (1 + Integer.parseInt(UsoPersisteceMySQLConnection.getCantidadDatos("marcas"))));
            }
            else {
                ocultarPanels();
            }        
            }
            }
            }
            }
            
    }//GEN-LAST:event_categoriaCBoxItemStateChanged

    /**
     * Método encargado de manejar el botón de aceptar el cual si es una busqueda
     * mostrará la información o si es ingreso guardará la información.
     * @param evt El evento que se da al seleccionar el botón.
     */
    private void aceptarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarBActionPerformed
        
        ArrayList<String> datosX = new ArrayList<String>();
        //Determina si está seleccionado en el combo box la opción de aplicación de internet y realiza lo necesario.
        if(ProductoJP.isVisible() || MarcaJP.isVisible() || ProveedorJP.isVisible()) {    
            
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Producto de Tienda")){
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDProveedor(String.valueOf(proveedorCB.getSelectedItem())));
                datosX.add(precioCompra1.getText());
                datosX.add(precioCompra2.getText());
                datosX.add(precioCompra.getText());
                datosX.add(precioSVenta.getText());
                datosX.add(precioVenta.getText());
                UsoPersisteceMySQLConnection.agregarPreciosProducto(datosX);
                vaciarArrayTextFields(datosX);
                datosX.add(usuarioTF.getText());
                datosX.add(contraseñaTF.getText());
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDMarca(String.valueOf(marcaTB.getSelectedItem())));
                datosX.add(UsoPersisteceMySQLConnection.getCantidadDatos("precios_producto"));
                UsoPersisteceMySQLConnection.agregarProductosTienda(datosX);
                vaciarArrayTextFields(datosX);
                
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Producto de Libreria")){
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDProveedor(String.valueOf(proveedorCB.getSelectedItem())));
                datosX.add(precioCompra1.getText());
                datosX.add(precioCompra2.getText());
                datosX.add(precioCompra.getText());
                datosX.add(precioSVenta.getText());
                datosX.add(precioVenta.getText());
                UsoPersisteceMySQLConnection.agregarPreciosProducto(datosX);
                vaciarArrayTextFields(datosX);
                datosX.add(usuarioTF.getText());
                datosX.add(contraseñaTF.getText());
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDMarca(String.valueOf(marcaTB.getSelectedItem())));
                datosX.add(UsoPersisteceMySQLConnection.getCantidadDatos("precios_producto"));
                UsoPersisteceMySQLConnection.agregarProductosLibreria(datosX);
                vaciarArrayTextFields(datosX);
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Productos varios")){
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDProveedor(String.valueOf(proveedorCB.getSelectedItem())));
                datosX.add(precioCompra1.getText());
                datosX.add(precioCompra2.getText());
                datosX.add(precioCompra.getText());
                datosX.add(precioSVenta.getText());
                datosX.add(precioVenta.getText());
                UsoPersisteceMySQLConnection.agregarPreciosProducto(datosX);
                vaciarArrayTextFields(datosX);
                datosX.add(usuarioTF.getText());
                datosX.add(contraseñaTF.getText());
                datosX.add(UsoPersisteceMySQLConnection.encontrarIDMarca(String.valueOf(marcaTB.getSelectedItem())));
                datosX.add(UsoPersisteceMySQLConnection.getCantidadDatos("precios_producto"));
                UsoPersisteceMySQLConnection.agregarProductosVarios(datosX);
                vaciarArrayTextFields(datosX);
            }
            else{
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Proveedores")){
                datosX.add(usuarioTF2.getText());
                datosX.add(jTextArea2.getText());
                UsoPersisteceMySQLConnection.agregarProveedor(datosX);
                vaciarArrayTextFields(datosX);
                setModels(UsoPersisteceMySQLConnection.encontrarNombresMarcas(),UsoPersisteceMySQLConnection.encontrarNombresProveedor() );
            }
            else {
            if (String.valueOf(this.categoriaCBox.getSelectedItem()).equals("Marcas")){
                datosX.add(usuarioTF1.getText());
                datosX.add(jTextArea1.getText());
                UsoPersisteceMySQLConnection.agregarMarca(datosX);
                vaciarArrayTextFields(datosX);
                setModels(UsoPersisteceMySQLConnection.encontrarNombresMarcas(),UsoPersisteceMySQLConnection.encontrarNombresProveedor() );
            }
            else {
                ocultarPanels();
            }        
            }
            }
            }
            }
        }
        vaciarTextFields();
    }//GEN-LAST:event_aceptarBActionPerformed

   // "Producto de Tienda", "Producto de Libreria", "Productos varios", "Proveedores", "Marcas"
    
    /**
     * Método que permite cancelar la información que se estaba ingresando.
     * @param evt 
     */
    private void cancelarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarBActionPerformed
        setModels(UsoPersisteceMySQLConnection.encontrarNombresMarcas(),UsoPersisteceMySQLConnection.encontrarNombresProveedor() );
        vaciarTextFields();
        this.limpiar();
        this.campos=0;
    }//GEN-LAST:event_cancelarBActionPerformed

    /**
     * Método que permite sugerirle una contraseña al usuario.
     * @param evt El evento que se da al presionar el botón.
     */
    private void marcaTBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_marcaTBItemStateChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_marcaTBItemStateChanged

    private void marcaTBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_marcaTBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_marcaTBActionPerformed

    private void proveedorCBItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_proveedorCBItemStateChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_proveedorCBItemStateChanged

    private void proveedorCBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_proveedorCBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_proveedorCBActionPerformed

    private void usuarioTF1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usuarioTF1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_usuarioTF1ActionPerformed

    private void usuarioTF2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usuarioTF2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_usuarioTF2ActionPerformed

    private void precioCompraInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_precioCompraInputMethodTextChanged
       
    }//GEN-LAST:event_precioCompraInputMethodTextChanged

    private void precioCompraKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_precioCompraKeyPressed
       
    }//GEN-LAST:event_precioCompraKeyPressed

    private void precioCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_precioCompraActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompraActionPerformed

    private void precioCompraFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_precioCompraFocusLost
        float as;
        Float toReturnF = new Float(0);
        try {
            as = Float.parseFloat(precioCompra.getText());
            toReturnF = as * (float)1.15;
        }
        catch(Exception ex){
            JOptionPane.showMessageDialog(null, "recuende ingresar solo numeros.");
        }
        finally {
            DecimalFormat df = new DecimalFormat("0.00"); 
            precioSVenta.setText("" + df.format(toReturnF));
            String toStringX = precioSVenta.getText();
        }        
    }//GEN-LAST:event_precioCompraFocusLost

    private void precioCompra1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_precioCompra1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra1ActionPerformed

    private void precioCompra1FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_precioCompra1FocusLost
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra1FocusLost

    private void precioCompra1InputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_precioCompra1InputMethodTextChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra1InputMethodTextChanged

    private void precioCompra1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_precioCompra1KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra1KeyPressed

    private void precioCompra2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_precioCompra2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra2ActionPerformed

    private void precioCompra2FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_precioCompra2FocusLost
        
                
                
                
                
                
    }//GEN-LAST:event_precioCompra2FocusLost

    private void precioCompra2InputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_precioCompra2InputMethodTextChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra2InputMethodTextChanged

    private void precioCompra2KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_precioCompra2KeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_precioCompra2KeyPressed

    
    private void setModels(String[] marcasX, String[] proveedoresX){
        marcaTB.setModel(new javax.swing.DefaultComboBoxModel(marcasX));
        proveedorCB.setModel(new javax.swing.DefaultComboBoxModel(proveedoresX));
    }
    
    
    /**
     * Método que maneja la clase.
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new MenuIngreso().setVisible(true);
            }
        });
    }
    
    /**
     * Metodo utilizado para vaciar el arreglo en el que se almacenan temporalmente
     * los datos de determinado grupo.
     */
    public void vaciarArrayTextFields(ArrayList<String> X3) {
        for(int x=0; x<X3.size(); x = 0){
            X3.remove(x);
        }
    }
    
    public void vaciarTextFields(){
        usuarioTF1.setText("");
        usuarioTF2.setText("");
        usuarioTF.setText("");
        jTextArea1.setText("");
        jTextArea2.setText("");
        contraseñaTF.setText("");
        precioCompra.setText("0.00");
        precioSVenta.setText("0.00");
        precioVenta.setText("0.00");
    }
    //------------------------------------------------------------------------
    //Atributos 
    //------------------------------------------------------------------------
    
    private int campos = 0;
    private boolean seleccion = true;
    private static Cuenta cuenta;

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ID_p;
    private javax.swing.JLabel ID_p1;
    private javax.swing.JLabel ID_p2;
    private javax.swing.JLabel IDp;
    private javax.swing.JLabel IDp1;
    private javax.swing.JLabel IDp2;
    private javax.swing.JPanel MarcaJP;
    private javax.swing.JPanel ProductoJP;
    private javax.swing.JPanel ProveedorJP;
    private javax.swing.JButton aceptarB;
    private javax.swing.JButton backmenuB;
    private javax.swing.JButton cancelarB;
    private javax.swing.JComboBox categoriaCBox;
    private javax.swing.JLabel codigoL;
    private javax.swing.JTextField contraseñaTF;
    private javax.swing.JLabel detalleXM;
    private javax.swing.JLabel detalleXM1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JLabel marcaL;
    private javax.swing.JComboBox marcaTB;
    private javax.swing.JLabel nombreL;
    private javax.swing.JLabel nombreLp;
    private javax.swing.JLabel nombreLp1;
    private javax.swing.JLabel nombreUsuarioShowL;
    private javax.swing.JFormattedTextField precioCompra;
    private javax.swing.JFormattedTextField precioCompra1;
    private javax.swing.JFormattedTextField precioCompra2;
    private javax.swing.JLabel precioDcompra;
    private javax.swing.JLabel precioDcompra1;
    private javax.swing.JLabel precioDcompra2;
    private javax.swing.JLabel precioDventa;
    private javax.swing.JFormattedTextField precioSVenta;
    private javax.swing.JLabel precioSventa;
    private javax.swing.JFormattedTextField precioVenta;
    private javax.swing.JLabel proveedor;
    private javax.swing.JComboBox proveedorCB;
    private javax.swing.JLabel tituloPanelL;
    private javax.swing.JLabel usuarioShowL;
    private javax.swing.JTextField usuarioTF;
    private javax.swing.JTextField usuarioTF1;
    private javax.swing.JTextField usuarioTF2;
    // End of variables declaration//GEN-END:variables
}
